package d8;

public class offer10_1 {
    /**
     * F(0) = 0,   F(1) = 1
     * F(N) = F(N - 1) + F(N - 2), 其中 N > 1.
     */
    public int fib(int n) {
        int[] arr = new int[n + 1];
        arr[0] = 0;
        if (n >= 1)
            arr[1] = 1;
        for (int i = 2; i <= n; i++) {
            arr[i] = (arr[i - 1] + arr[i - 2]) % 1000000007;
        }
        return arr[n];
    }

    public static void main(String[] args) {
        int res = new offer10_1().fib(1);
        System.out.println(res);
    }
}
